#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<assert.h>
#include<time.h>
typedef int type;
typedef struct node
{
	int val;
	struct node* next;
}Node;

typedef struct stock
{
	int length;
	Node* top;
}Stock;

void Init(Stock *p)
{
	p->top = NULL;
	p->length = 0;
};

Node* BuyNode(Stock* p)
{
	Node* tmp = (Node*)malloc(sizeof(Node));
	p->top = tmp;
	return p->top;
}

void Push(Stock* p,type x)
{
	Node*newnode=BuyNode(p);
	newnode->val = x;
	if (p->top == NULL)
	{
		p->top = newnode;
	}
	else
	{
		p->top->next = newnode;
		p->top = newnode;
	}
}

bool Empty(Stock*p)
{
	return p->top == NULL;
}

type Top(Stock* p)
{
	assert(!Empty(p));
	return p->top->val;
}

void Pop(Stock* p)
{
	assert(!Empty(p));
	Node* next = p->top->next;
	free(p->top);
	p->top = p->top->next;
}

//void Insert(Stock*p)
//{
//
//}
int main()
{
	Stock st;
	Init(&st);
	Push(&st,4);
	Push(&st, 3);
	int ret = Top(&st);
	printf("%d", ret);
}

